﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A77重写父类中的方法
{
    class Program
    {
        static void Main(string[] args)
        {
            Dog dog = new Dog();
            dog.Say();

            Cat cat = new Cat();
            cat.Say();
        }
    }
    class Animal
    {
        public virtual  void Say() // virtual 表示这个方法可以被子类重写
        {
            Console.WriteLine("叫");
        }
    }
    class Dog:Animal
    {
        public override void Say()
        {
            base.Say();
            Console.WriteLine("汪汪");
        }
    }
    class Cat:Animal
    {
        public override void Say()
        {
            base.Say();
            Console.WriteLine("喵喵");
        }
    }
}